#规则路由：http://base.com/admin/auth/rule?ref=addtabs

luyiran
vW2VGXmv9HAR5xDW

#用户表
DROP TABLE IF EXISTS `yr_member`;
CREATE TABLE `yr_member` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`openid` varchar(50) NOT NULL DEFAULT '' COMMENT 'openid',
`avatar` varchar(255) DEFAULT NULL COMMENT '用户图像',
`username` varchar(32) NOT NULL DEFAULT '' COMMENT '用户名',
`nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '昵称',
`mobile` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号',
`level` tinyint(1)  NOT NULL DEFAULT '0' COMMENT '等级',
`gender` tinyint(1)  NOT NULL DEFAULT '0' COMMENT '性别',
`birthday` int(11) DEFAULT NULL COMMENT '生日',
`credit` float(11) NOT NULL DEFAULT '0' COMMENT '积分',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='用户表';


#轮播
DROP TABLE IF EXISTS `lyr_banner`;
CREATE TABLE `lyr_banner` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL COMMENT 'Banner名称',
`description` varchar(255) DEFAULT NULL COMMENT 'Banner描述',
`images` varchar(255) DEFAULT NULL COMMENT '图片',
`createtime` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='轮播列表';

php think crud -t banner -c banner/index -u 1
php think crud -t banner -c banner/index -d 1


#商品分类
DROP TABLE IF EXISTS `lyr_cate`;
CREATE TABLE `lyr_cate` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL COMMENT '分类名称',
`image` varchar(100) DEFAULT NULL COMMENT '分类图片',
`description` varchar(100) DEFAULT NULL COMMENT '描述',
`delete_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='商品类目';

php think crud -t cate -c goods/cate -u 1
php think crud -t cate -c goods/cate -d 1

#商品列表
DROP TABLE IF EXISTS `lyr_goods`;
CREATE TABLE `lyr_goods` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL COMMENT '商品名称',
`price` decimal(6,2) NOT NULL COMMENT '价格,单位：分',
`stock` int(11) NOT NULL DEFAULT '0' COMMENT '库存量',
`category_id` int(11) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL COMMENT '缩略图',
`summary` varchar(50) DEFAULT NULL COMMENT '商品介绍',
`images` varchar(255) DEFAULT NULL COMMENT '商品图片',
`from` tinyint(4) NOT NULL DEFAULT '1' COMMENT '图片来自 1 本地 ，2公网',
`createtime` int(11) DEFAULT NULL COMMENT '创建时间',
`updatetime` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='商品';

php think crud -t goods -r cate -k category_id -p id  -c goods/goods -u 1
php think crud -t goods -r cate -k category_id -p id  -c goods/goods -d 1

#用户表
DROP TABLE IF EXISTS `lyr_member`;
CREATE TABLE `lyr_member` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`openid` varchar(50) NOT NULL,
`nickname` varchar(50) DEFAULT NULL,
`avatar_image` varchar(100) DEFAULT NULL COMMENT '头像',
`deletetime` int(11) DEFAULT NULL,
`createtime` int(11) DEFAULT NULL COMMENT '注册时间',
PRIMARY KEY (`id`),
UNIQUE KEY `openid` (`openid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用户表';

php think crud -t member -c member/member -u 1
php think crud -t member -c member/member -d 1


#精选主题
DROP TABLE IF EXISTS `lyr_theme`;
CREATE TABLE `lyr_theme` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL COMMENT '专题名称',
`description` varchar(255) DEFAULT NULL COMMENT '专题描述',
`image` varchar(255) NOT NULL COMMENT '图片',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='主题信息表';

php think crud -t theme -c theme/theme -u 1
php think crud -t theme -c theme/theme -d 1

#主题商品
DROP TABLE IF EXISTS `lyr_theme_goods`;
CREATE TABLE `lyr_theme_goods` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`theme_id` int(11) NOT NULL COMMENT '主题外键',
`goods_id` int(11) NOT NULL COMMENT '商品外键',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='主题商品';


php think crud -t theme_goods -r theme -r goods -k theme_id -k goods_id -c theme/product -u 1
php think crud -t theme_goods -r theme -r goods -k theme_id -k goods_id -c theme/product -d 1


#购物车
DROP TABLE IF EXISTS `lyr_cart`;
CREATE TABLE `lyr_cart` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`openid` varchar(50) NOT NULL DEFAULT 0 COMMENT 'openid',
`goods_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品id',
`total` int(6) NOT NULL DEFAULT 0 COMMENT '商品数量',
`price` decimal(6,2) NOT NULL DEFAULT 0 COMMENT '商品单价',
`seleted` int(1) NOT NULL DEFAULT 1 COMMENT '选中:1=选中 0=未选中',
`createtime` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`deletetime` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='购物车';

php think crud -t cart -r member -r goods -k openid -k goods_id -c cart/cart -u 1
php think crud -t cart -r member -r goods -k openid -k goods_id -c cart/cart -d 1


#收货地址
DROP TABLE IF EXISTS `lyr_address`;
CREATE TABLE `lyr_address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`openid` varchar(50) NOT NULL DEFAULT 0 COMMENT 'openid',
`username` varchar(50) NOT NULL DEFAULT 0 COMMENT '收货人',
`mobile` int(11) NOT NULL DEFAULT 0 COMMENT '联系方式',
`address` varchar(60) NOT NULL DEFAULT 0 COMMENT '详细地址',
`default` int(1) NOT NULL DEFAULT 0 COMMENT '选中:1=选中 0=未选中',
`createtime` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`deletetime` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='收货地址';



#订单表
DROP TABLE IF EXISTS `lyr_order`;
CREATE TABLE `lyr_order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`openid` varchar(50) NOT NULL DEFAULT 0 COMMENT 'openid',
`ordersn` varchar(50) NOT NULL DEFAULT 0 COMMENT '订单号',
`price` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '订单金额',
`address_id` varchar(60) NOT NULL DEFAULT 0 COMMENT '地址id',
`status` int(1) NOT NULL DEFAULT 0 COMMENT '支付状态:0=未支付 1=已支付 2=取消',
`createtime` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`deletetime` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='订单表';

#订单商品表
DROP TABLE IF EXISTS `lyr_order_goods`;
CREATE TABLE `lyr_order_goods` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL DEFAULT 0 COMMENT 'openid',
`goods_id`int(11) NOT NULL DEFAULT 0 COMMENT '订单金额',
`total` varchar(60) NOT NULL DEFAULT 0 COMMENT '商品数量',
`createtime` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`deletetime` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='订单商品';















#活动时间段
DROP TABLE IF EXISTS `lyr_activity`;
CREATE TABLE `lyr_activity` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名',
`times` varchar(120) NOT NULL DEFAULT '' COMMENT '时间段',
`closesec` char(80) NOT NULL DEFAULT '0' COMMENT '自动取消时间',
`status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '状态:0=禁用,1=启用',
`createtime` int(10) NOT NULL DEFAULT '0'  COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='活动时间';

php think crud  -t activity   -c  seckill/activity -u 1


#秒杀商品
DROP TABLE IF EXISTS `lyr_goods`;
CREATE TABLE `lyr_goods` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(20) NOT NULL DEFAULT '' COMMENT '名称',
`images` varchar(255) NOT NULL DEFAULT '' COMMENT '图片',
`stock` int(11) NOT NULL DEFAULT '0' COMMENT '库存',
`createtime` int(10) NOT NULL DEFAULT '0'  COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='秒杀商品';

php think crud  -t goods   -c  seckill/goods -u 1
php think crud  -t goods   -c  seckill/goods -d 1

#秒杀活动
DROP TABLE IF EXISTS `lyr_kill`;
CREATE TABLE `lyr_kill` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`year` char(4) NOT NULL DEFAULT '0' COMMENT '年',
`month` char(4) NOT NULL DEFAULT '0' COMMENT '月',
`day` char(4) NOT NULL DEFAULT '0' COMMENT '日',
`goods_ids` int(11) NOT NULL DEFAULT '0' COMMENT '商品',
`price` char(20) NOT NULL DEFAULT '0' COMMENT '秒杀价格',
`stock` int(10) NOT NULL DEFAULT '0' COMMENT '秒杀库存',
`time_id` int(11) NOT NULL DEFAULT '0' COMMENT '时间段',
`createtime` int(10) NOT NULL DEFAULT '0'  COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='秒杀活动';


php think crud  -t kill -r goods -r activity -k goods_ids -k time_id  -c  seckill/kill -u 1
php think crud  -t kill -r goods -r activity -k goods_ids -k time_id  -c  seckill/kill -d 1







































